# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: TDY <tdy@gmx.com>
# Contributor: Nelson Menon <nelsonmenon@gmail.com insanatorium.wordpress.com>

pkgname=freecol
pkgver=1.0.0
pkgrel=1
pkgdesc="A turn-based strategy game based on Colonization"
arch=('any')
url="http://www.freecol.org/"
license=('GPL')
depends=('java-runtime>=11')
source=(https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.zip
        freecol.sh)
sha512sums=('dbc2f8189d33b4cefddb89f68b10a4dde7345a7dcceea39fe8be73cd52d702d70f4c13de915a1a24b4901ae151a9f1fca6ab2937389fa427c29ec8b2727b2111'
            '90cf7eed5a81e5dd2bc9c609a18713422e98f0447841aaf650c9408f75d9405995cdfc0e471955c50d383de20c79e3454de139c3221cec8a16fbc0c0a9e79fab')

package() {
  cd "$srcdir/$pkgname"

  install -Dm644 FreeCol.jar "$pkgdir/usr/share/java/$pkgname/FreeCol.jar"
  install -Dm644 FreeCol.pdf "$pkgdir/usr/share/doc/$pkgname/FreeCol.pdf"
  install -Dm644 $pkgname.xpm "$pkgdir/usr/share/pixmaps/$pkgname.xpm"
  install -Dm644 freecol.desktop "$pkgdir/usr/share/applications/$pkgname.desktop"
  install -Dm755 "$srcdir"/freecol.sh "$pkgdir/usr/bin/$pkgname"

  cp -r data jars "$pkgdir/usr/share/java/$pkgname/"
  find "$pkgdir/usr/share/java/$pkgname" -type d -exec chmod 755 '{}' \;
  find "$pkgdir/usr/share/java/$pkgname" -type f -exec chmod 644 '{}' \;
}
